//
//  PhotoAsset.h
//  XPhoto
//
//  Created by baboy on 2019/6/11.
//  Copyright © 2019 baboy. All rights reserved.
//

#import "Model.h"
#import <Photos/Photos.h>
#define PHOTO_ASSET_TYPE_PHOTO  1
#define PHOTO_ASSET_TYPE_VIDEO  2
NS_ASSUME_NONNULL_BEGIN


extern UIInterfaceOrientation AVAssetOrientation(AVAsset *asset);
typedef NS_ENUM(NSInteger, PhotoAssetType) {
    PhotoAssetTypePhoto          = 0,
    PhotoAssetTypeVideo     = 1
};

@interface PhotoAsset : Model
@property(nonatomic, strong) PHAsset *asset;
@property(nonatomic, strong) UIImage *thumbImage;
@property(nonatomic, strong) UIImage *originImage;
@property(nonatomic, strong) NSString *thumbPath;
@property(nonatomic, strong) NSString *originPath;
@property(nonatomic, strong) NSURL *assetURL;
@property(nonatomic, strong) NSString *remoteUrl;

@property(nonatomic, assign) NSInteger width;
@property(nonatomic, assign) NSInteger height;
@property(nonatomic, assign) NSInteger type;
@property(nonatomic, assign) float duration;
- (id)initWithAsset:(nullable PHAsset*)asset thumbnail:(nullable UIImage*)thumbnail;
- (id)initWithAsset:(nullable PHAsset*)asset;
+ (void)mergeVideos:(NSArray *)videos
         toFilePath:(NSURL *)fileURL
           progress:(void (^)(CGFloat))progress
         completion:(void (^)(NSError *,PhotoAsset*))completion;
@end

NS_ASSUME_NONNULL_END
